<template>
  <div class="flex m-10">
    <draggable class="dragArea list-group w-full" :list="list" @change="log">
      <div
        class="list-group-item bg-gray-300 m-1 p-3 rounded-md text-center"
        v-for="element in list"
        :key="element.name"
      >
        {{ element.name }}
      </div>
    </draggable>
  </div>
</template>
<script>
  import { defineComponent, watch } from 'vue';
  import { VueDraggableNext } from 'vue-draggable-next'
  export default defineComponent({
    components: {
      draggable: VueDraggableNext,
    },
    data() {
      return {
        enabled: true,
        list: [
          { name: '小李', id: 1 },
          { name: '小王', id: 2 },
          { name: '小赵', id: 3 },
          { name: 'Gerard', id: 4 },
        ],
        dragging: false,
      }
    },
    methods: {
      log(event) {
        console.log(event)
      },
    },
  })
</script>
<style lang="scss">
.dragArea{
  display: flex;
}
  .list-group-item{
    width:400px;
    height:400px;
    border:2px solid blue;
     background:red;
    margin-top:20px;
    font-size: 40px;
    color: white;
  }   
</style>